---@class Battle.EntitySignSystem: Battle.EntityComponent
local EntitySignSystem = Battle.CreateClass("EntitySignSystem",Battle.EntityComponent)
Battle.EntitySignSystem = EntitySignSystem
function EntitySignSystem:OnCreate()
    self.signFlagDic = {}
end

function EntitySignSystem:HasSign(signId)
    local count = self.signFlagDic[signId] or 0
    return count > 0
end

function EntitySignSystem:AddSign(signId)
    local count = self.signFlagDic[signId] or 0
    self.signFlagDic[signId] = count + 1
    if count == 0 then
        self.actor.eventSystem:FireEvent(Battle.Event.ActorSignChange,Battle.EventArgs.EntitySignChangeArgs:Create(self.actor,signId,true))
    end
end

function EntitySignSystem:RemoveSign(signId,isClear)
    local count = self.signFlagDic[signId] or 0
    if count == 0 then
        return
    end
    if isClear then
        self.signFlagDic[signId] = 0
    else
        self.signFlagDic[signId] = count - 1
    end
    if count > 0 and self.signFlagDic[signId] == 0 then
        self.actor.eventSystem:FireEvent(Battle.Event.ActorSignChange,Battle.EventArgs.EntitySignChangeArgs:Create(self.actor,signId,false))
    end
end
